<template>
	<view class="content">
		<view class="uni-container statistics_bg">
			<uni-table ref="table" border stripe v-if="type==0">
				<uni-tr>
					<uni-th align="center">时段</uni-th>
					<uni-th align="center">铝锭(公斤/公斤)</uni-th>
					<uni-th align="center">石墨(公斤/公斤)</uni-th>
					<uni-th align="center">脱模剂(公斤/公斤)</uni-th>
					<uni-th align="center">刀具</uni-th>
					<uni-th align="center">电(度/公斤)</uni-th>
					<uni-th align="center">燃气(立方米/公斤)</uni-th>
					
					
					
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index">
					<uni-td align="center">{{ item.period }}</uni-td>
					<uni-td align="center">
						<view class="name">{{ item.aluminum_ingot_per_kg }}</view>
					</uni-td>
					<uni-td align="center">{{ item.graphite_per_kg }}</uni-td>
					<uni-td align="center">{{ item.mold_release_agent_per_kg }}</uni-td>
					<uni-td align="center">{{ item.tool_per_kg }}</uni-td>
					<uni-td align="center">{{ item.electricity_per_kg }}</uni-td>
					<uni-td align="center">{{ item.gas_per_kg }}</uni-td>
				</uni-tr>
			</uni-table>
			
		</view>
	</view>
</template>

<script>
	
	import {GetOperationsOverview} from '../../common/opsoverview_api.js'
	
	export default {
		data() {
			return {
				type:0,//0:成品 1：原料
				tableData:[],
			}
		},
		onLoad(option) {
			uni.setNavigationBarTitle({
				title: "单位成品消耗明细"
			})
		
			this.loadData();
		},
		
		methods: {
			loadData(){
				GetOperationsOverview().then(res => {
					var array = [];
					for (var i = 0; i < res.length; i++) {
						var item = res[i];
						array.push(item);
					}
					this.tableData = array;
				});
				
			},

		},
	}
</script>

<style>
	@import url("opsoverview-detail.css");
</style>
